<{if empty($member['member_id'])}>
<form id="add_link" action='<{link app="verification" ctl="admin_members" act="addMember"}>' method="POST" class="tableform">
<{else /}>
<form id="add_link" action='<{link app="verification" ctl="admin_members" act="editMember"}>' method="POST" class="tableform">
<{/if}>
    <div class="division">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" >
        	<tr>
        		<th>帐号所属商户：</th>
        			<td>
        				<{$seller.seller_name|default:''}>
        			</td>
        	</tr>
        	<{if !empty($store.store_id)}>
        	<tr>
        		<th>帐号所属门店：</th>
        			<td>
        				<{$store.store_name|default:''}>
        			</td>
        	</tr>
        	<{/if}>
			
			<{if empty($member['member_id'])}>
            <tr>
                <th><em class="red">*</em><{t}>用户名：<{/t}></th>
                <td>
                	<{input type='text' id="username" name='username' value=$member.username|default:'' vtype='required' required='true' size=30}>
                    <br />(最长为15位，但最好不要超过11位，否则用户端显示不全)
                </td>
            </tr>
			<{else /}>
			<tr>
                <th><em class="red">*</em><{t}>用户名：<{/t}></th>
                <td>
                	<{input type='text' id="username" readonly="readonly" name='username' value=$member.username|default:'' vtype='required' required='true' size=30}>
                    <br />(最长为15位，但最好不要超过11位，否则用户端显示不全)
                </td>
            </tr>
			<{/if}>
			
            <tr>
            <{if empty($member['member_id'])}>
                <th><em class="red">*</em><{t}>密码：<{/t}></th>
                <td>
                	<{input type="password" name="password" value="" vtype="required" required="true" size=30}>
                </td>
                <{else /}>
                <th>重置密码：</th>
                <td>
                	<{input type="password" name="password" value="" size=30}>
                	<br />(注意：不需重置密码，请将该行留空)
                </td>
                <{/if}>
            </tr>
            <tr>
            	<th>账户状态：</th>
            	<td>
            	<{if !empty($member['member_id'])}>
            		<label>启用
            		<input type="radio" name="status" value="true" <{if $member['status'] == 'true'}>checked="checked"<{/if}> />
            		</label>
            		<label>禁用
            		<input type="radio" name="status" value="false" <{if $member['status'] == 'false'}>checked="checked"<{/if}> />
            		</label>
            		<{else /}>
            		<label>启用
            		<input type="radio" name="status" value="true" checked="checked" />
            		</label>
            		<label>禁用
            		<input type="radio" name="status" value="false"  />
            		</label>
            		<{/if}>
            	</td>
            </tr>
        </table>
    </div>
    <{if !empty($member['member_id'])}>
    <input type="hidden" name="member_id" value="<{$member.member_id|default:0}>">
    <{/if}>
    <{if !empty($store['store_id'])}>
    	<input type="hidden" name="type" value="store">
        <input type="hidden" name="store_id" value="<{$store.store_id}>">
        <input type="hidden" name="seller_id" value="<{$seller.seller_id}>">
    <{else /}>
       <input type="hidden" name="type" value="seller">
       <input type="hidden" name="seller_id" value="<{$seller.seller_id}>">
    <{/if}>
    <div class="table-action">
        <{button id="btn" type='button' label=$___a='保存'|t:'verification' onclick="sub_form(event);" }>
    </div>
</form>

<script>

function sub_form(event) {
    var $username = ($('username').get('value')).trim();
    if($username.length > 15){
        alert('用户名不能超过15位');
        return false;
    }
    $('add_link').fireEvent('submit',new Event(event));
}

$('add_link').store('target',{
    onComplete:function($data){
        $data = eval("("+$data+')');
        if($data.success){
            $('add_link').getParent('.dialog').retrieve('instance').close();
        }
    }
});
</script>